<template>
  <view class="com-a-component">
    <view class="title">子组件A</view>
    <view class="content">
      <text>父组件传进来的值：</text>
      <text class="intent-value">{{ intent }}</text>
    </view>
    <button @click="sendData" type="primary" size="mini">传值给CompB组件</button>
  </view>
</template>

<script>
export default {
  props: {
    intent: {
      type: String,
      default: '默认值'
    }
  },
  methods: {
    sendData() {
      console.log("ComA组件发送数据：" + this.intent)
      uni.$emit('comAtoComB', this.intent)
    }
  }
}
</script>

<style>
.com-a-component {
  margin: 20rpx 0;
  padding: 25rpx;
  border: 2rpx solid #4CAF50;
  border-radius: 12rpx;
  background-color: #f9fff9;
}

.title {
  font-size: 32rpx;
  font-weight: bold;
  color: #4CAF50;
  margin-bottom: 15rpx;
}

.intent-value {
  color: #ff5722;
  font-weight: bold;
  margin-left: 10rpx;
}
</style>